package com.example.mvpdemo.base;

import com.example.mvpdemo.login.contract.LoginContract;

/**
 * name 控制器
 * desc 控制VIEW和MODEL
 * author Sy
 * email 564379992@qq.com
 * created 2020/5/6 15:30
 */
public abstract class BasePresenter<V extends BaseActivity, M extends BaseModel, CONTACT> extends SuperBase<CONTACT> {

    public V mView;

    public M mModel;


    public BasePresenter(){
        this.mModel = getModelInstance();
    }

    /**
     * 绑定视图层
     * @param mView
     */
    public void bindView(V mView){
        this.mView = mView;
    }

    /**
     * 解绑VIEW
     */
    public void unBindView(){
        this.mView = null;
    }

    /**
     * 子类实例化MODEL层
     * @return
     */
    public abstract M getModelInstance();
}
